﻿@using System.Diagnostics;
@using NewLife.Common;
@using NewLife.Cube.Admin;
@using NewLife.Serialization;
@{
    var fs = Model as List<FileItem>;
    var r = ViewBag.Current as String;
    var clips = ViewBag.Clip as ICollection<FileItem>;

    var dataList = new List<object>();


    foreach (var item in fs)
    {

        dataList.Add(new
        {
            Name = item.Name,
            Size = item.Size,
            LastWrite = item.LastWrite.ToFullString("")
        });
    }
}
<div class="form-inline">
    <form action="~/Admin/File" id="tool" method="post">
        <div class="input-group">
            <span class="input-group-addon">
                <i class="ace-icon fa fa-check"></i>
            </span>
            <input name="r" type="search" id="r" value="@r" class="form-control" placeholder="当前路径" />
            <span class="input-group-btn">
                <button type="submit" class="btn btn-primary btn-sm">
                    <span class="glyphicon glyphicon-folder-open icon-on-right bigger-110"></span>
                    打开
                </button>
            </span>
        </div>
        <div class="input-group">
            <span class="input-group-addon">
                <i class="glyphicon glyphicon-file"></i>
            </span>
            <input name="file" type="file" id="file" placeholder="上传文件" />
            <span class="input-group-btn">
                <button type="submit" class="btn btn-success btn-sm" onclick="$('#tool').attr('action', '/Admin/File/Upload');$('#tool').attr('enctype', 'multipart/form-data'); return true;">
                    <span class="glyphicon glyphicon-plus icon-on-right bigger-110"></span>
                    上传
                </button>
            </span>
        </div>
        @if (clips.Count > 0)
        {
            <div class="input-group">
                <span class="input-group-addon">
                    <i class="glyphicon glyphicon-floppy-disk" title="剪切板共有 @clips.Count 项">@clips.Count</i>
                </span>
                <span class="input-group-btn">
                    <button type="button" class="btn btn-pink btn-sm" onclick="location.href = '/Admin/File/Paste?r=@r';">
                        <span class="glyphicon glyphicon-floppy-save icon-on-right bigger-110"></span>
                        粘贴
                    </button>
                </span>
                <span class="input-group-btn">
                    <button type="button" class="btn btn-gray btn-sm" onclick="location.href = '/Admin/File/Move?r=@r';">
                        <span class="glyphicon glyphicon-floppy-save icon-on-right bigger-110"></span>
                        移动
                    </button>
                </span>
                <span class="input-group-btn">
                    <button type="button" class="btn btn-yellow btn-sm" onclick="location.href = '/Admin/File/ClearClipboard?r=@r';">
                        <span class="glyphicon glyphicon-retweet icon-on-right bigger-110"></span>
                        清空
                    </button>
                </span>
            </div>
        }
    </form>
</div>

<el-table :data="tableData"
          style="width: 100%">
    <el-table-column prop="Name"
                     label="名称"
                     width="180">
    </el-table-column>
    <el-table-column prop="Size"
                     label="大小"
                     width="180">
    </el-table-column>
    <el-table-column prop="LastWrite"
                     label="修改时间"
                     width="180">
    </el-table-column>

    <el-table-column label="操作" min-width="220" fixed="right">
        <template slot-scope="scope">

            <el-button type="text" size="mini">复制</el-button>
            <el-button type="text" size="mini">压缩</el-button>
            <el-button type="text" size="mini">删除</el-button>

        </template>
    </el-table-column>
</el-table>
@section scripts{

    <script>
        //Vue2.0 桌面端组件库: https://element.eleme.cn/#/zh-CN/component/cascader

        var main = new Vue({
            el: '#app',
            data: {

                tableData: @Html.Raw(dataList.ToJson()),

            },
            //页面初始化
            created() {

            },
            methods: {

            },

        });

    </script>

}
